package richbar.com.richbar.activity;
import android.app.Activity;
import android.content.Intent;
import android.support.v4.view.ViewPager;
import com.common.base.BaseActivity;
import com.common.util.StatusBarUtil;
import java.io.Serializable;
import java.util.List;
import richbar.com.richbar.R;
import richbar.com.richbar.adapter.PreviewPicAdapter;

/**
 * Created by qyang on 2018-4-4.
 */

public class PreviewPicAc extends BaseActivity {
    private final static String PATH = "path";
    private final static String POSITION = "position";
    public static void start(Activity mActivity, List<String> path, int position){
        Intent intent = new Intent(mActivity,PreviewPicAc.class);
        intent.putExtra(POSITION,position);
        intent.putExtra(PATH, (Serializable)path);
        mActivity.startActivity(intent);
    }
    /*private ImageView photoView;
    private PhotoViewAttacher attacher;
    private String path;*/
    private ViewPager viewPager;
    private PreviewPicAdapter adapter;

    @Override
    public int initLayout() {
        return R.layout.activity_preview_pic;
    }

    @Override
    public void initTitle() {

    }

    @Override
    public void initView() {
        StatusBarUtil.setTransparent(this);
    }

    @Override
    public void initData() {
        if (getIntent() != null){
            List<String> path = (List<String>) getIntent().getSerializableExtra(PATH);
            int position = getIntent().getIntExtra(POSITION,0);
            viewPager = findViewById(R.id.viewpager);
            adapter = new PreviewPicAdapter(path,this);
            viewPager.setAdapter(adapter);
            viewPager.setCurrentItem(position);
        }
    }
}
